<template>
<div class="four">
    <p>恭喜您，修改密码成功</p>
    <span>正在为您跳转至首页…&nbsp;</span> <span>倒计时: {{time}}s</span>
    <div @click="goHome()"> <a>手动跳转</a> </div>
</div>
</template>

<script>
export default {
    name: "PasFour",
    data() {
        return {
            time: 10
        }
    },
    //  倒计时
    created() {
        let num = this.time;
        if (num == 10) {
            let timer = setInterval(() => {
                num--;
                // console.log(num)
                this.time = num
                if (num == 0) {
                    this.$router.push({
                        name: 'home'
                    })
                    clearInterval(timer)
                }
            }, 1000)
        }
    },

    methods: {
        goHome() {
            this.$router.push({
                name: 'home'
            })
        }
    },
}
</script>

<style lang="less" scoped>
.four {

    text-align: center;

    p {
        font-size: 20px;
        color: #5fb878;
        margin-bottom: 40px;
    }

    div {
        padding: 15px 0 250px;
    }
}
</style>
